<?php
/**
 * Created by PhpStorm
 * User: Jhinwy
 * Date: 7/25/24
 * Time: 2:55 PM
 */

namespace app\adminapi\controller\recycle;


use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\recycle\ReportLists;

/**
 * Report控制器
 *
 * Class OrderController
 * @package app\adminapi\controller
 */
class ReportController extends BaseAdminController
{

    /**
     * @notes 回收报表
     *
     * @return \think\response\Json
     * @author likeadmin
     * @date 2024/02/01 10:45
     */
    public function lists()
    {
        return $this->dataLists(new ReportLists());
    }


    public function total()
    {
        return $this->success('success', (new ReportLists())->getTotal());
    }


    public function export()
    {
        list($filepath, $filename) = (new ReportLists())->export();

        if (is_file($filepath)) {

            return $this->data(['url' => env('APP.HOST') . 'excel/' . $filename]);
        }

        return $this->fail('下载失败');
    }
}
